#include <CL/cl.h>
#include <stdio.h>

int main() {
    cl_platform_id platform;
    cl_device_id device;
    cl_context context;
    cl_int err;

    clGetPlatformIDs(1, &platform, NULL);
    clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, 1, &device, NULL);
    context = clCreateContext(NULL, 1, &device, NULL, NULL, &err);

    cl_ulong max_alloc, global_mem;
    clGetDeviceInfo(device, CL_DEVICE_MAX_MEM_ALLOC_SIZE, sizeof(max_alloc), &max_alloc, NULL);
    clGetDeviceInfo(device, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof(global_mem), &global_mem, NULL);

    printf("Max alloc size: %.2f MiB\n", max_alloc / 1024.0 / 1024.0);
    printf("Global mem size: %.2f MiB\n", global_mem / 1024.0 / 1024.0);

    clReleaseContext(context);
    return 0;
}
